/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nutmotion.utils;

/**
 *
 * @author Manu
 */
public class StringBuilderAppendHelper {
    private String prefix;
    private String separator;
    private StringBuilder stringBuilder;

    public StringBuilderAppendHelper(String prefix, String separator) {
        this.prefix = prefix;
        this.separator = separator;
        this.stringBuilder = new StringBuilder();
    }

    public void append(String stringToAppend) {
        if (stringBuilder.length() == 0) {
        // this is the first string we append
            stringBuilder.append(prefix);
        }
        else {        
            stringBuilder.append(separator);
        }

        stringBuilder.append(stringToAppend);       
    }

    @Override
    public String toString() {
        return this.stringBuilder.toString();
    }
}
